VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
END
Attribute VB_Name = "Location"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"No"
Option Explicit

Enum ModuleSection
    sectNone
    sectGlobal
    sectEvent
    sectProc
    sectPropGet
    sectPropLet
    sectPropSet
End Enum

Enum ModulePosition
    posNone
    posBegin
    posEnd
    posAbsolute
    posRelative
End Enum

Const sSep = ";"
Const sValSep = ":"
Const sSectGlobal = "Global"
Const sSectEvent = "Event"
Const sSectProc = "Proc"
Const sSectPropGet = "PropGet"
Const sSectPropLet = "PropLet"
Const sSectPropSet = "PropSet"
Const sPosBegin = "Begin"
Const sPosEnd = "End"
Const sPosAbsolute = "Absolute"
Const sPosRelative = "Relative"

Private mvarCodeModule As String
Private mvarObjectName As String
Private mvarEventName As String
Private mvarSection As ModuleSection
Private mvarProcName As String
Private mvarPosition As ModulePosition
Private mvarLineNumber As Long


Friend Sub Initialize(sLocation$)
    Dim sPosition$, sSection$, sSectName$, sPosName$
    
    mvarObjectName = ""
    mvarEventName = ""
    mvarSection = sectNone
    mvarProcName = ""
    mvarPosition = posNone
    mvarLineNumber = 0

    mvarCodeModule = Str_Token(sLocation, sSep, 0)
    sSection = Str_Token(sLocation, sSep, 1)
    sPosition = Str_Token(sLocation, sSep, 2)
    
    ' Parse section block
    sSectName = Str_Token(sSection, sValSep, 0)
    If (sSectName = "") Then
        mvarSection = sectGlobal
    Else
        Select Case sSectName
            Case sSectGlobal
                mvarSection = sectGlobal
            Case sSectProc
                mvarSection = sectProc
                mvarProcName = Str_Token(sSection, sValSep, 1)
            Case sSectEvent
                mvarSection = sectEvent
                mvarObjectName = Str_Token(sSection, sValSep, 1)
                mvarEventName = Str_Token(sSection, sValSep, 2)
            Case sSectPropGet
                mvarSection = sectPropGet
                mvarProcName = Str_Token(sSection, sValSep, 1)
            Case sSectPropLet
                mvarSection = sectPropLet
                mvarProcName = Str_Token(sSection, sValSep, 1)
            Case sSectPropSet
                mvarSection = sectPropSet
                mvarProcName = Str_Token(sSection, sValSep, 1)
        End Select
    End If
    
    ' Parse position block
    sPosName = Str_Token(sPosition, sValSep, 0)
    If (sPosName = "") Then
        mvarSection = posBegin
    Else
        Select Case sPosName
            Case sPosBegin
                mvarPosition = posBegin
            Case sPosEnd
                mvarPosition = posEnd
            Case sPosAbsolute
                mvarPosition = posAbsolute
                mvarLineNumber = Str_Token(sPosition, sValSep, 1)
            Case sPosRelative
                mvarPosition = posRelative
        End Select
    End If
End Sub

Public Property Get LineNumber() As Long
    LineNumber = mvarLineNumber
End Property

Public Property Get Position() As ModulePosition
Attribute Position.VB_Description = "Can be one of: Begin, End, Absolute, Relative"
    Position = mvarPosition
End Property

Public Property Get ProcName() As String
    ProcName = mvarProcName
End Property

Public Property Get Section() As ModuleSection
Attribute Section.VB_Description = "Can be one of: global, proc, event, property"
    Section = mvarSection
End Property

Public Property Get EventName() As String
    EventName = mvarEventName
End Property

Public Property Get ObjectName() As String
    ObjectName = mvarObjectName
End Property

Public Property Get CodeModule() As String
Attribute CodeModule.VB_Description = "Code module full path"
    CodeModule = mvarCodeModule
End Property



